home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / wgt / dsik_c / exam1.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-27  |  1.7 KB  |  78 lines

  1. /*  exam1.c - Digital Sound Interface Kit V1.01a example code
  2.  
  3.     Copyright 1993,94 Carlos Hasan
  4. */
  5.  
  6. #include <stdio.h>
  7. #include <conio.h>
  8. #include <dos.h>
  9. #include "sound.h"
  10. #include "ts.h"
  11.  
  12. int main(void)
  13. {
  14.     DSMCard Card;
  15.     DSM *Module;
  16.     int Volume;
  17.  
  18.     if (DSMLoadSetup(&Card)) {
  19.         printf("Please run SETUP.EXE to configure.\n");
  20.         return 1;
  21.     }
  22.     if (DSMInit(&Card)) {
  23.         printf("Error Initializing the Sound System.\n");
  24.         return 1;
  25.     }
  26.     if ((Module = DSMLoad("64MANIA.DSM",0L)) == NULL) {
  27.         switch (DSMStatus) {
  28.         case ERR_NORAM:  printf("Not enough system memory.\n"); break;
  29.         case ERR_NODRAM: printf("Not enough card memory.\n"); break;
  30.         case ERR_NOFILE: printf("File not found.\n"); break;
  31.         case ERR_FORMAT: printf("Invalid file format.\n"); break;
  32.         case ERR_ACCESS: printf("File damaged.\n"); break;
  33.         }
  34.         DSMDone();
  35.         return 1;
  36.     }
  37.     printf("Playing music.\n");
  38.     DSMSetupVoices(Module->Song.NumChannels,Module->Song.MasterVolume);
  39.     DSMPlayMusic(Module);
  40.  
  41. #ifdef __TS_H
  42.     TSInit();
  43.     TSSetRate(70);
  44.     TSSetRoutine(DSMPoll);
  45. #endif
  46.  
  47.     for (Volume = 0; Volume < 256; Volume++) {
  48. #ifndef __TS_H
  49.         DSMPoll();
  50. #endif
  51.         DSMSetMusicVolume(Volume);
  52.         delay(20);
  53.     }
  54.  
  55.     while (!kbhit()) {
  56. #ifndef __TS_H
  57.         DSMPoll();
  58. #endif
  59.     }
  60.  
  61.     for (Volume = 255; Volume > 0; Volume--) {
  62. #ifndef __TS_H
  63.         DSMPoll();
  64. #endif
  65.         DSMSetMusicVolume(Volume);
  66.         delay(20);
  67.     }
  68.  
  69.     DSMStopMusic();
  70.     DSMFree(Module);
  71. #ifdef __TS_H
  72.     TSDone();
  73.     TSRestoreTime();
  74. #endif
  75.     DSMDone();
  76.     return 0;
  77. }
  78.